ADD_EXECUTABLE(test main.cpp)

IF(WIN32)
  INCLUDE_DIRECTORIES(${GRFPACK_SOURCE_DIR}/3rdparty/zlib-1.2.7/include)
  TARGET_LINK_LIBRARIES(test optimized ${GRFPACK_SOURCE_DIR}/3rdparty/zlib-1.2.7/lib/zlibstatic.lib debug ${GRFPACK_SOURCE_DIR}/3rdparty/zlib-1.2.7/lib/zlibstaticd.lib)
  FOREACH(flag_var CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
    IF(${flag_var} MATCHES "/MD")
      STRING(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
    ENDIF(${flag_var} MATCHES "/MD")
    IF(${flag_var} MATCHES "/MDd")
      STRING(REGEX REPLACE "/MDd" "/MTd" ${flag_var} "${${flag_var}}")
    ENDIF(${flag_var} MATCHES "/MDd")
  ENDFOREACH(flag_var)
ELSE(UNIX)
  FIND_PACKAGE(ZLIB REQUIRED)
  INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIRS})
  TARGET_LINK_LIBRARIES(test ${ZLIB_LIBRARIES})
ENDIF(WIN32)

ADD_LIBRARY(GRFPack GrfPack.cpp GrfPack.hpp)
TARGET_LINK_LIBRARIES(test GRFPack)